package com.bw.liuyushan.liuyushan20210929.Utils;

import android.database.sqlite.SQLiteDatabase;

import com.bw.liuyushan.liuyushan20210929.Entity.App;
import com.bw.liuyushan.liuyushan20210929.GreenDao.DaoMaster;
import com.bw.liuyushan.liuyushan20210929.GreenDao.DaoSession;

/**
 * Liuyushan20210929
 * file name is : GoodBeanUtils
 * created by Ender on 2021/9/29 17:51.
 * author : 刘雨杉
 * Describe:
 */
public class GoodBeanUtils {
    DaoSession daoSession;

    private  static GoodBeanUtils goodBeanUtils;

    public static GoodBeanUtils getInstance() {
        if (goodBeanUtils==null){
            goodBeanUtils=new GoodBeanUtils();
        }
        return goodBeanUtils;
    }

    private GoodBeanUtils() {
        DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(App.context, "goodMonth.db");
        SQLiteDatabase writableDatabase = devOpenHelper.getWritableDatabase();
        DaoMaster daoMaster = new DaoMaster(writableDatabase);
        daoSession = daoMaster.newSession();
    }

    public DaoSession getDaoSession() {
        return daoSession;
    }
}
